<?php
// +----------------------------------------------------------------------
// | flow-notify / User.php    [ 2021/11/10 10:19 上午 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2021 zhangqiquan All rights reserved.
// +----------------------------------------------------------------------
// | Author: zhangqiquan <768617998@qq.com>
// +----------------------------------------------------------------------
declare (strict_types=1);


namespace notify\unipush;


trait User
{
    /**
     * 查询用户状态
     * @param array $cids
     * @return mixed
     */
    public function getUserStatus(array $cids){
        $header = [
            'Content-Type: application/json',
            'token: '.$this->getToken()
        ];
        $cids = implode(',', $cids);
        return $this->curlRequest('https://restapi.getui.com/v2/'.$this->config['app_id'].'/user/status/'.$cids, [], $header, false);
    }

    /**
     *查询设备的状态
    注意：
    1. 该接口返回设备在线时，仅表示存在集成了个推SDK的应用在线
    2.该接口返回设备不在线时，仅表示不存在集成了个推SDK的应用在线
    3.该接口需要开通权限，如需开通，请联系右侧技术咨询
     * @param array $cids
     * @return mixed
     */
    public function getUserDeviceStatus(array $cids){
        $header = [
            'Content-Type: application/json',
            'token: '.$this->getToken()
        ];
        $cids = implode(',', $cids);
        return $this->curlRequest('https://restapi.getui.com/v2/'.$this->config['app_id'].'/user/deviceStatus/'.$cids, [], $header, false);
    }

    /**
     * 查询用户信息
     * @param array $cids
     * @return mixed
     */
    public function getUserDetail(array $cids){
        $header = [
            'Content-Type: application/json',
            'token: '.$this->getToken()
        ];
        $cids = implode(',', $cids);
        return $this->curlRequest('https://restapi.getui.com/v2/'.$this->config['app_id'].'/user/detail/'.$cids, [], $header, false);
    }
}